#include <stdio.h>
#include <string.h>

int isRotatedString(char* s1, char* s2) {
    int len1 = strlen(s1);
    int len2 = strlen(s2);
    if (len1 != len2) { // 如果两个字符串长度不同，直接返回0
        return 0;
    }
    int count = 0;
    int j = 0;
    while (j < len1) {
        if (s2[j] != s1[len1 - 1 - j]) { // 如果当前字符不相等，说明不是旋转字符串
            return 0;
        }
        j++;
        count++; // 计数器加1
    }
    return count;
}

int main() {
    char s1[] = "Hello";
    char s2[] = "loleH";
    int count = isRotatedString(s1, s2);
    if (count > 0) {
        printf("s2 is a rotated string of s1, and needs %d flips to restore.\n", count);
    } else {
        printf("s2 is not a rotated string of s1.\n");
    }
    return 0;
}